package com.ymt.bpm.service.engine.task;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ymt.bpm.model.PTaskTodo;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by Johnny on 2017/4/19.
 */
public interface TiService {

    JSONObject saveDraft(String tenantId, String loginName,
                                String tiId,
                                String title,
                                String lang,
                                int timezoneOffset);

    JSONObject draftFromTpl(String tenantId, String loginName, String tiId);

    ModelAndView getTodoView(String tenantId, ModelAndView view,
                             String loginName, String tiId, String contextRealPath,
                             String lang, int timezoneOffset, String formLocation);

    ModelAndView getPiView(String tenantId, ModelAndView view, String loginName,
                                  String piEidEnc, String doneTiId,
                                  String contextRealPath, String lang, int timezoneOffset, String formLocation);

    JSONObject complete(String tenantId, String loginName,
                        String tiId,
                        JSONObject params);

    JSONObject completeTask(String tenantId, PTaskTodo todo,
                            JSONObject bpmnConfig, JSONObject params, boolean completeEngineTask);

    /*JSONArray getRejectingActivities(String tenantId, String tiId,
                                     String activityId, String piEid);*/

    JSONObject returnTask(String tenantId, String loginName, String displayName, String tiId,
                          JSONObject params);

    JSONObject reassignTask(String tenantId, String loginName, String displayName, String tiId, String assignTo, String assignToName, String comment);

    JSONObject involve(String tenantId, String loginName, String displayName, String tiId, String comment, String involveType, String involedUsers, JSONObject params);

    JSONObject defer(String tenantId, String loginName, String tiId);

    JSONObject claim(String tenantId, String loginName, String tiId, String piId, String activityId);

    JSONObject unclaim(String tenantId, String loginName, String tiId, String piId, String activityId);

}
